package com.huanggf.meituan.tabhost;


import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TabHost;

import com.huanggf.meituan.MainActivity;
import com.huanggf.meituan.R;


public class MainTabHostActivity extends TabActivity {

    private TabHost tabHost;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_tabhost_layout);
        tabHost = (TabHost) findViewById(android.R.id.tabhost);

        LayoutInflater layoutInflater = LayoutInflater.from(this);
        View tabhostImg1 = layoutInflater.inflate(R.layout.tabhost_main, null);
        View tabhostImg2 = layoutInflater.inflate(R.layout.tabhost_membership, null);
        View tabhostImg3 = layoutInflater.inflate(R.layout.tabhost_order, null);
        View tabhostImg4 = layoutInflater.inflate(R.layout.tabhost_account, null);
        tabHost.addTab(tabHost.newTabSpec("main_layout").setIndicator(tabhostImg1)
                .setContent(new Intent(this, MainActivity.class)));
        tabHost.addTab(tabHost.newTabSpec("membership_layout").setIndicator(tabhostImg2)
                .setContent(new Intent(this, MembershipActivity.class)));
        tabHost.addTab(tabHost.newTabSpec("order_layout").setIndicator(tabhostImg3)
                .setContent(new Intent(this, OrderActivity.class)));
        tabHost.addTab(tabHost.newTabSpec("account_layout").setIndicator(tabhostImg4)
                .setContent(new Intent(this, AccountActivity.class)));

    }
}
